<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"
	template="layout/template.xhtml">

	<ui:define name="body">

		<h:form id="project" styleClass="edit">

			<rich:panel>
				<f:facet name="header">#{projectHome.managed ? 'Edit' : 'Add'}
					Project</f:facet>

				<s:decorate id="descriptionField" template="layout/edit.xhtml">
					<ui:define name="label">Description</ui:define>
					<h:inputTextarea id="description" cols="80" rows="3"
						value="#{projectHome.instance.description}" />
				</s:decorate>

				<s:decorate id="labelField" template="layout/edit.xhtml">
					<ui:define name="label">Label</ui:define>
					<h:inputTextarea id="label" cols="80" rows="3"
						value="#{projectHome.instance.label}" />
				</s:decorate>

				<s:decorate template="layout/edit.xhtml">
					<ui:define name="label">Work Stores</ui:define>
					<h:selectManyMenu value="#{projectHome.instance.workStores}"
						required="true">
						<s:selectItems value="#{workStoreList.resultList}"
							var="store" label="#{store.label}" noSelectionLabel="Select Work Store(s)..." />
						<s:convertEntity />
						<s:validate />
					</h:selectManyMenu>
				</s:decorate>

				<s:decorate template="layout/edit.xhtml">
					<ui:define name="label">Work Stores</ui:define>
					<h:selectManyMenu value="#{projectHome.instance.projectManagers}"
						required="true">
						<s:selectItems value="#{managerList.resultList}"
							var="manager" label="#{manager.cn}" noSelectionLabel="Select Project Manager(s)..." />
						<s:convertEntity />
						<s:validate />
					</h:selectManyMenu>
				</s:decorate>

				<div style="clear:both">
					<span class="required">*</span>
					required fields
				</div>

			</rich:panel>

			<div class="actionButtons">

				<h:commandButton id="save" value="Save"
					action="#{projectHome.persist}" disabled="#{!projectHome.wired}"
					rendered="#{!projectHome.managed}" />

				<h:commandButton id="update" value="Save"
					action="#{projectHome.update}" rendered="#{projectHome.managed}" />

				<h:commandButton id="delete" value="Delete"
					action="#{projectHome.remove}" immediate="true" rendered="#{projectHome.managed}" />

				<s:button id="cancelEdit" value="Cancel" propagation="end"
					view="/Project.xhtml" rendered="#{projectHome.managed}" />

				<s:button id="cancelAdd" value="Cancel" propagation="end"
					view="/#{empty projectFrom ? 'ProjectList' : projectFrom}.xhtml"
					rendered="#{!projectHome.managed}" />

			</div>
		</h:form>

	</ui:define>

</ui:composition>
